package com.supermap.business.cloud.market;

import com.alibaba.dubbo.config.annotation.Reference;
import com.supermap.dataservice.util.JSONUtil;
import com.supermap.dubbo.api.cloud.market.MarketinfoService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author aqua
 * @description
 * @date 2018年11月22 下午 9:55
 * @email 1301584033@qq.com
 */
@Controller
@RequestMapping("/cloud/market")
public class MarketController {
    @Reference(timeout = 100000)
    private MarketinfoService marketinfoService;

    @GetMapping("/getAllArea")
    @ResponseBody
    public JSONUtil getAllArea(){
        return  marketinfoService.getAllArea();
    }
    @GetMapping("/getAllMarktNameByAreaCode")
    @ResponseBody
    public JSONUtil getAllMarktNameByAreaCode(String areaCode){
        return  marketinfoService.getAllMarktNameByAreaCode(areaCode);
    }

    @GetMapping("/getLastOntDay")
    @ResponseBody
   public  JSONUtil getLastOntDay(String areaCode, String cropstype,String marketname){
       return  marketinfoService.getLastOntDay(areaCode,cropstype,marketname);
   }


    @GetMapping("/getLastSevenDay")
    @ResponseBody
    public JSONUtil  getLastSevenDay(String areaCode,String code,String marketname){
        return  marketinfoService.getLastSevenDay(areaCode,code,marketname);
    }

    /***
     *获取所有农贸市场
     * */
    @GetMapping("/getMarketTitle")
    @ResponseBody
    public  JSONUtil  getMarketTitle(){
        return  marketinfoService.getMarketTitle();
    }
    /***
     *根据农贸市场获取最近一次商品信息
     * */
    @GetMapping("/getlatelyFirstMarketinfo")
    @ResponseBody
    public JSONUtil  getlatelyFirstMarketinfo (String marketTitle){
        return  marketinfoService.getlatelyFirstMarketinfo(marketTitle);
    }
    /***
     *根据农贸市场和商品名称获取最近七次商品信息
     * */
    @GetMapping("/getlatelyTop7Market")
    @ResponseBody
    public JSONUtil  getlatelyTop7Market (String marketTitle,String goods){
        return  marketinfoService.getlatelyTop7Market(marketTitle,goods);
    }
}
